package org.s3.project.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.s3.project.entity.AddressBook;
import org.s3.project.mapper.AddressBookMapper;
import org.s3.project.service.AddressBookService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author cfx
 * @version 1.0
 * @Description
 * @date 2025/2/9 10:05
 */
@Service
public class AddressBookServiceImpl extends ServiceImpl<AddressBookMapper, AddressBook> implements AddressBookService {
    @Autowired
    private AddressBookMapper baseMapper;
    @Override
    public List<AddressBook> getDefaultAddressBook(int userId) {
        return baseMapper.selectAddressBook(userId);
    }

    @Override
    public int addAddressBook(AddressBook addressBook) {
        return baseMapper.AddAddressBook(addressBook);
    }

    @Override
    public int deleteAddressBook(int id) {
        return baseMapper.deleteAddressBook(id);
    }

    @Override
    public int updateAddressBook(AddressBook addressBook) {

        return baseMapper.updateAddressBook(addressBook);
    }

    @Override
    public Boolean UpdateIsDefault(long userId, long id) {
        return baseMapper.UpdateIsDefault(userId,id);
    }


}
